Skip to content

Format output text for rule results to improve readability #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 20, 2021
Merged

Format output text for rule results to improve readability #209

merged 1 commit into from
Jul 20, 2021

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Jul 20, 2021

Previously, the output text for the rule results had no formatting to speak of. It was simply a single, often long, line of text. Wrapping of this text was at the mercy of whatever displayed it. When there were multiple rule results in the output it melded into a wall of dense text.

The readability is improved by two formatting changes:

  • Format the rule level (e.g., ERROR, WARNING) text and the rule message text into separate columns
  • Wrap the rule message text, maintaining the column alignment after line breaks

This is accomplished by using github.com/olekukonko/tablewriter to put the result output for each rule is made into a single row, borderless table.

Example output from before this change:

ERROR: Library name Servo is in use by a library in the Library Manager index. Each library must have a unique name value. If your library is already in the index, use the "--library-manager update" flag. (Rule LP017)
WARNING: No license file found. See: https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/licensing-a-repository#detecting-a-license (Rule LD002)

after:

ERROR: Library name Servo is in use by a library in the Library Manager index. Each library must have a unique name
       value. If your library is already in the index, use the "--library-manager update" flag. (Rule LP017)
WARNING: No license file found. See:
         https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/licensing-a-repository#detecting-a-license
         (Rule LD002)

Previously, the output text for the rule results had no formatting to speak of. It was simply a single, often long, line of text. Wrapping of this text was at the mercy of whatever displayed it. When there were multiple rule results in the output it melded into a wall of dense text.

The readability is improved by two formatting changes:

- Format the rule level (e.g., ERROR, WARNING) text and the rule message text into separate columns
- Wrap the rule message text, maintaining the column alignment after line breaks

This is accomplished by putting the result output for each rule is made into a single row, borderless table.
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Jul 20, 2021
@codecov-commenter
Copy link

Codecov Report

Merging #209 (8889464) into main (24d0055) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #209      +/-   ##
==========================================
+ Coverage   87.93%   87.96%   +0.02%     
==========================================
  Files          43       43              
  Lines        4160     4170      +10     
==========================================
+ Hits         3658     3668      +10     
  Misses        391      391              
  Partials      111      111              
Flag Coverage Δ
unit 87.96% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
internal/result/result.go 90.22% <100.00%> (+0.79%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 24d0055...8889464. Read the comment docs.

@per1234 per1234 merged commit c87155d into arduino:main Jul 20, 2021
@per1234 per1234 deleted the format-output branch July 20, 2021 15:24
@per1234 per1234 self-assigned this Nov 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants